#ifndef NEWGAMEDIALOG_H
#define NEWGAMEDIALOG_H

#include <QDialog>
#include <QLabel>
#include <QLineEdit>
#include <QColor>
#include <QPushButton>
#include <QSpinBox>
#include <QGridLayout>
#include <QList>
#include <QMap>

class NewGameDialog : public QDialog
{
    Q_OBJECT
protected:
    //QLabel mClientIDLbl;
    //QLineEdit mClientIDEdit;

    QLabel mRoomIDLbl;
    QLineEdit mRoomIDEdit;

    QLabel mColorLbl;
    QPushButton mColorBtn;
    QColor mColor;
    static QList<QRgb> mRgbList;

    QLabel mFoodCountLbl;
    QSpinBox mFoodCountEdit;

    QLabel mGameTimeLbl;
    QSpinBox mGameTimeEdit;

    QLabel mUpKeyLbl;
    QLineEdit mUpKeyEdit;
    QLabel mDownKeyLbl;
    QLineEdit mDownKeyEdit;
    QLabel mLeftKeyLbl;
    QLineEdit mLeftKeyEdit;
    QLabel mRightKeyLbl;
    QLineEdit mRightKeyEdit;
    QLabel mGoKeyLbl;
    QLineEdit mGoKeyEdit;

    QPushButton mOkBtn;
    QPushButton mCancelBtn;

    QList<int> mKeyList;
    QMap<QObject*, int> mKeyMap;

    QString key2text(int key);
public:
    explicit NewGameDialog(QWidget *parent = 0);

    //QString getClientID();
    //void setClientID(QString id);
    int getRoomID();
    QColor getColor();
    void setColor(QColor c);
    int getFoodCount();
    void setFoodCount(int count);
    int getGameTime();
    void setGameTime(int t);
    QList<int> getKeyList();
    void setKeyList(QList<int> keyList);
    
protected slots:
    void onColorBtnClicked();
    void onOkBtnClicked();
    void onCancelBtnClicked();
    
protected:
    bool eventFilter(QObject* obj, QEvent* evt);
};

#endif // NEWGAMEDIALOG_H
